import numpy as np
import matplotlib.pyplot as plot
import pandas as pd
import sympy
import sklearn
from scipy.cluster.vq import kmeans

iris = sklearn.datasets.load_iris()
X = iris.data
Y = iris.target

def sk_linear():
    clf = sklearn.linear_model.SGDClassifier(max_iter=900)
    clf.fit(X, Y)
    T = clf.predict(X)
    error_count = 0
    for n in range(len(T)):
        if Y[n] != T[n]:
            print(n, X[n], Y[n], T[n])
            error_count = error_count + 1
    print(error_count)

def sk_kmeans():
    km=sklearn.cluster.KMeans(n_clusters=3)
    T=km.fit_predict(X)
    error_count = 0
    for n in range(len(T)):
        if Y[n] != T[n]:
            print(n, X[n], Y[n], T[n])
            error_count = error_count + 1
    print(error_count)

sk_kmeans()